package com.yingxue.demo.util;

import org.apache.shiro.crypto.hash.Md5Hash;

/**
 * @Package: com.company.demo.util
 * @Author: Mr.Waves
 * @Date: 2020-03-14 00:11
 * @Description:
 **/
public class PasswordUtil {

    public static boolean match(String salt, String password, String passwordCipher,Integer hashIterations) {
        Md5Hash md5Hash = new Md5Hash(password, salt, hashIterations);
        return md5Hash.toString().equals(passwordCipher);
    }

    public static String encipher(String password, String salt,Integer hashIterations) {
        Md5Hash md5Hash = new Md5Hash(password, salt, hashIterations);
        return md5Hash.toString();
    }
}
